package com.twu.biblioteca;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * Created by lauraionescu on 13/04/2014.
 */
public class Book extends Item {

    private String title;
    private String author;

    public Book(String title, String author){
        this.title = title;
        this.author = author;
    }

    public String toString(){
        return "\"" + title + "\", " + author;
    }

    public boolean equals(Object toBeCompared){
        if (toBeCompared instanceof Book)
            return (title.equals(((Book) toBeCompared).getTitle()) && author.equals(((Book) toBeCompared).getAuthor()));
        else
            return false;
    }

    public String getTitle(){
        return title;
    }

    public String getAuthor(){
        return author;
    }

    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

}
